package com.zeratul.common.strategy.event;

import com.zeratul.common.strategy.aspect.StrategyAspect;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.endpoint.event.RefreshEvent;
import org.springframework.context.ApplicationListener;

/**
 * 监听配置刷新事件
 */
@Slf4j
public class RefreshEventListener implements ApplicationListener<RefreshEvent> {
    /**
     * 配置刷新
     * @param event
     */
    @Override
    public void onApplicationEvent(RefreshEvent event) {
        log.info("【策略架构】监听到配置刷新事件：{}", event.getEventDesc());
        //配置刷新，则清除缓存
        StrategyAspect.cacheClear();
    }
}
